package com.mr.cai.main.utils;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.mr.cai.main.R;
import com.mr.cai.main.adapter.ClassifyPopAdapter;
import com.mr.cai.main.view.BasePopupWindow;

/**
 * Created by Administrator on 16-2-28.
 */
public class ClassifySelPop extends BasePopupWindow{
    private RecyclerView mRecycleView;
    private View view;

    public ClassifySelPop(Context mContext) {
        super(mContext);
    }

    @Override
    protected void initView(Context mContext) {
        view=View.inflate(mContext, R.layout.classify_pop_layout,null);
        this.pop.setContentView(view);
        mRecycleView=(RecyclerView)view.findViewById(R.id.popSelLv);
        mRecycleView.setLayoutManager(new LinearLayoutManager(mContext));
        final ClassifyPopAdapter adapter=new ClassifyPopAdapter(mContext);
        mRecycleView.setAdapter(adapter);
        adapter.setOnItemClickListener(new ClassifyPopAdapter.OnItemClickLitener() {
            @Override
            public void onItemClick(View view, int position) {
                adapter.setmPosition(position);
                dismiss();
                if(onItemClickListener!=null){
                    onItemClickListener.onItemClick(position);
                }
            }
        });
    }

    @Override
    public void loadingData() {

    }

    @Override
    protected void destoryData() {

    }

    @Override
    public void onClick(View view) {

    }
}
